// ++++++++++++++++++++++++++++++++++++++++
// 《零基础Go语言算法实战》源码
// ++++++++++++++++++++++++++++++++++++++++
// Author:廖显东（ShirDon）
// Blog:https://www.shirdon.com/
// Gitee:https://gitee.com/shirdonl/goAlgorithms.git
// Buy link :https://item.jd.com/14101229.html
// ++++++++++++++++++++++++++++++++++++++++

package main

import "fmt"

// 此接口将支持具有给定基础类型的任何类型
type TypeNumber interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~float32 | ~float64
}

// 具有底层 int 的类型
type Point int

func Max[T TypeNumber](a, b T) T {
	if a > b {
		return a
	}
	return b
}

func main() {
	// 创建点类型
	a, b := Point(6), Point(8)

	fmt.Println(Max(a, b))
}

//$ go run generics6.go
//8
